//
//  PointCell.m
//  Commerce
//
//  Created by 高飞 on 15/7/12.
//  Copyright (c) 2015年 fei. All rights reserved.
//

#import "PointCell.h"

@implementation PointCell

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)configUIWithData:(NSDictionary *)dic{
    _pointLabel.text = dic[@"Name"];
    [_pointLabel sizeToFit];
    [_nameLabel setFrame:CGRectMake(_pointLabel.frame.origin.x+_pointLabel.frame.size.width+5, _nameLabel.frame.origin.y, _nameLabel.frame.size.width, _nameLabel.frame.size.height)];
    _nameLabel.text = dic[@"LinkName"];
    _telLabel.text = dic[@"Phone"];
    _phoneLabel.text = dic[@"Tel"];
    _addressLabel.text = dic[@"Address"];
}

- (IBAction)callphone:(id)sender{
    [[GlobalData sharedGlobalData] phoneBtnActWithNum:_phoneLabel.text];
    //传入的参数
    NSString *user_name = [[GlobalData sharedGlobalData] userinfoDic][@"UserName"];
    if (!user_name) {
        user_name = @"";
    }
    NSString *url = [NSString stringWithFormat:@"%@user/boda?api_key=%@&user_name=%@&to_username=%@",URL_ROOT,[[@"1234567890!@#" md5HexDigest] uppercaseString],user_name,_phoneLabel.text];
    [[BaseNetwork alloc] initWithMethodUrl:url
                                    params:nil
                               requestMode:DGHTTPMethodGET
                               loadingShow:YES
                              didFinshLoad:^(id result) {
                              }];
}

- (IBAction)calltel:(id)sender{
    [[GlobalData sharedGlobalData] phoneBtnActWithNum:_telLabel.text];
    //传入的参数
    NSString *user_name = [[GlobalData sharedGlobalData] userinfoDic][@"UserName"];
    if (!user_name) {
        user_name = @"";
    }
    NSString *url = [NSString stringWithFormat:@"%@user/boda?api_key=%@&user_name=%@&to_username=%@",URL_ROOT,[[@"1234567890!@#" md5HexDigest] uppercaseString],user_name,_telLabel.text];
    [[BaseNetwork alloc] initWithMethodUrl:url
                                    params:nil
                               requestMode:DGHTTPMethodGET
                               loadingShow:YES
                              didFinshLoad:^(id result) {
                              }];
}

@end
